package ddd1;

public class work2 {
    public static void main(String[] args) {
        String s1 = "332122";
        int i1 = parseInt(s1);
        System.out.println("String："+s1 +"int："+ i1);
    }
    public static int parseInt(String str){//字符转数字
        int count=str.length();
        int number;
        int sum=0;
        for(int i=0;i<str.length();i++){
            number=str.charAt(i)-48;
            sum+= (int) (number*Math.pow(10,count));
            count--;
        }
        return sum/10;
    }
}
